import request from '@/utils/request'

// 查询分类列表
export function listCategory(query) {
    return request({
        url: '/cms/manager/category/list',
        method: 'get',
        params: query
    })
}

export function listAllCategory(query) {
    return request({
        url: '/cms/manager/category/all/list',
        method: 'get',
        params: query
    })
}

export function listTreeCategory(query) {
    return request({
        url: '/cms/manager/category/trees',
        method: 'get',
        params: query
    })
}
// 查询分类详细
export function getCategory(id) {
    return request({
        url: '/cms/manager/category/' + id,
        method: 'get'
    })
}

// 新增分类
export function addCategory(data) {
    return request({
        url: '/cms/manager/category',
        method: 'post',
        data: data
    })
}

// 修改分类
export function updateCategory(data) {
    return request({
        url: '/cms/manager/category',
        method: 'put',
        data: data
    })
}

// 删除分类
export function delCategory(id) {
    return request({
        url: '/cms/manager/category/' + id,
        method: 'delete'
    })
}

export function batchDelCategory(ids) {
    return request({
        url: '/cms/manager/category/batch/delete',
        method: 'post',
        data: ids
    })
}
